<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>游戏新闻</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

</head>

<body>
    <div id="app">
        <!-- <news v-for="item in newsList" :ctime="item.ctime" :title="item.title" :description="item.description"
            :source="item.source" :picurl="item.picUrl" :url="item.url" :key="item.id"></news> -->
            <news v-for="item in newsList" :obj="item" :key="item.id"></news>
    </div>


    <script type="module">
    import news from './component.js'
        var app = new Vue({
            el: "#app",
            data: {
                newsList: []
            },
            created() {
                let xhr = new XMLHttpRequest();
                let url = "http://api.tianapi.com/esports/index?key=e5df028fd20892f8103f9724e6dd85cf&num=10";
                xhr.open("GET", url);
                xhr.send();
                xhr.onload = function () {              
                    app.newsList = JSON.parse(xhr.response).newslist;

                }
            }
        })



    </script>
</body>

</html>